what is a network switch and how does it work